package com.niit.beans;

import java.util.*;
import java.util.Map.Entry;

public class User {
    // 属性 property
    private int id;
    public void setId(int id) {
        this.id = id;
    }

    // 泛型
    private List<String> hobbies;

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }

    private Set<String> friends;

    public void setFriends(Set<String> friends) {
        this.friends = friends;
    }

    private Map<String,Integer> scores;

    public void setScores(Map<String, Integer> scores) {
        this.scores = scores;
    }

    private Dept dept;
    public void setDept(Dept dept) {
        System.out.println("setDept()......");
        this.dept = dept;
    }
    public void callTeamBuilding() {
        System.out.println("calling Dept......");
        System.out.println("id="+id);
        dept.teamBuilding();

        // Lamda 表达式
        hobbies.forEach(hobby -> System.out.println(hobby));
        friends.forEach(friend -> System.out.println(friend));

        Set<String> keysets = scores.keySet();
        for(String key : keysets){
            System.out.println(key+":"+scores.get(key));
        }

        for(Entry<String,Integer> entry : scores.entrySet()){
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
    }
}
